﻿<Window x:Class="ULSDeobfuscator.ComplexFiltersWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:ULSDeobfuscator="clr-namespace:ULSDeobfuscator"
        mc:Ignorable="d" 
        d:DataContext="{d:DesignInstance Type=ULSDeobfuscator:ComplexFilterViewModel}"
        Title="Manage Exclusion Filters" 
        d:DesignHeight="300" d:DesignWidth="300"
        Left="{Binding WindowLeft, Mode=TwoWay}"
        Top="{Binding WindowTop, Mode=TwoWay}" 
        ShowInTaskbar="False">
    
    <Window.Resources>
        
        <Style x:Key="LargeButtonStyle"
               TargetType="Button">
            <Setter Property="Height" Value="25" />
            <Setter Property="Width" Value="80" />
        </Style>

    </Window.Resources>
    <Grid Margin="5">
        
        <Grid.RowDefinitions>
            <!-- 0: explanations -->
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        
        <TextBlock TextWrapping="Wrap"
                   Grid.Row="0" Grid.ColumnSpan="2">
            The following expressions filter out the text messages in all logs.
        </TextBlock>
        
        <ListView Grid.Row="1" Grid.Column="0"
                  ItemsSource="{Binding Filters, Mode=OneWay}"
                  SelectedItem="{Binding CurrentFilter, Mode=TwoWay}"
                  Margin="0,5,5,0"
                  SelectionMode="Single">
            <ListView.View>
                <GridView AllowsColumnReorder="False">
                    <GridView.Columns>

                        <GridViewColumn Header="Expression" 
                                        Width="{Binding ExpressionColumnWidth, Mode=TwoWay}"
                                        DisplayMemberBinding="{Binding FilterExpression}" />
                        <GridViewColumn Header="Regexp ?" 
                                        Width="{Binding RegexColumnWidth, Mode=TwoWay}"
                                        DisplayMemberBinding="{Binding IsRegex}" />
                        <GridViewColumn Header="Case Sensitive ?"
                                        Width="{Binding CaseSensibleColumnWidth, Mode=TwoWay}"
                                        DisplayMemberBinding="{Binding IsCaseSensitive}" />
                    </GridView.Columns>
                </GridView>
            </ListView.View>
        </ListView>
        
        <Button Grid.Row="1" Grid.Column="1"
                VerticalAlignment="Top"
                Content="Edit..."
                Margin="0,25,0,0"
                Style="{StaticResource LargeButtonStyle}"
                Command="{Binding EditCommand}" />
        <Button Grid.Row="1" Grid.Column="1"
                VerticalAlignment="Bottom"
                Content="Delete"
                Style="{StaticResource LargeButtonStyle}"
                Command="{Binding DeleteCommand}" />
        
        <Button Grid.Row="2"
                Content="Add..."
                Margin="0,5,0,5"
                HorizontalAlignment="Left"
                Style="{StaticResource LargeButtonStyle}"
                Command="{Binding AddCommand}" />
        
        <StackPanel Orientation="Horizontal"
                    Grid.Row="3" Grid.ColumnSpan="2"
                    Margin="0,10,0,0"
                    HorizontalAlignment="Right">
            <Button Content="OK"
                    Style="{StaticResource LargeButtonStyle}"
                    IsDefault="True"
                    Command="{Binding OKCommand}" />
            <Button Content="Cancel"
                    Style="{StaticResource LargeButtonStyle}"
                    Margin="20,0,0,0"
                    IsCancel="True"
                    Command="{Binding CancelCommand}" />
            
        </StackPanel>
    </Grid>
</Window>
